Next | Prev | Up | Top | Contents | Index

Load

When a module is loaded, the following operations take place:

  1. The object file's header is read.

  2. Memory is allocated for the module's text, data, and bss.

  3. The module's text and data are read.

  4. The module's text and data are relocated, and unresolved references into the kernel are resolved.

  1. A symbol table is created for the module; the module is added into the appropriate kernel switch table.

  2. The module's drvinit() function is called.
Space allocated for the module's text, data, and bss is located in either k0seg or k2seg. Static buffers in loadable modules are not necessarily physically contiguous in memory.

A module can be loaded using the following lboot command:

% lboot -L master

A module can also be loaded using the following ml command:

% ml ld -[v] -[cbBfm] module.o -p prefix \ [-s major major...] [-a modname]

If a major number is specified by the ml command, that major number must match the major number used to create the corresponding device in /dev. If a major number is not specified, a device needs to be created in /dev with the major number selected by the ml command. The major number selected by the ml command can be found by using the ml list command described below. For more information about creating devices, see the mknod(1M) man page entry.

If a module is loaded successfully by the ml command, an id number, which can be used to unload the module, is returned.


Next | Prev | Up | Top | Contents | Index